﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Management/MedicalDirector/MasterDirect.master" AutoEventWireup="true" CodeFile="Nhacungcap.aspx.cs" Inherits="Management_MedicalDirector_Nhacungcap" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:SqlDataSource ID="nhacungcap" runat="server" ConnectionString="<%$ ConnectionStrings:HOSPITALMANAGEMENTConnectionString %>" DeleteCommand="DELETE FROM [tbSupplier] WHERE [ID] = @ID" InsertCommand="INSERT INTO [tbSupplier] ([Name], [Address], [Tel]) VALUES (@Name, @Address, @Tel)" SelectCommand="SELECT [ID], [Name], [Address], [Tel] FROM [tbSupplier] ORDER BY [Name]" UpdateCommand="UPDATE [tbSupplier] SET [Name] = @Name, [Address] = @Address, [Tel] = @Tel WHERE [ID] = @ID">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="Address" Type="String" />
            <asp:Parameter Name="Tel" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="Address" Type="String" />
            <asp:Parameter Name="Tel" Type="String" />
            <asp:Parameter Name="ID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
        <table style="width:100%;">
            <tr>
                <td clas="tdtalbe" style="text-align:center; color:red;padding-bottom:10px">
                    <asp:Label ID="lbTitle1" runat="server" Text="Danh sách nhà cung cấp thuốc" Font-Size="Large"></asp:Label>
                </td>
                <td style="text-align:center;color:green">
                    <asp:Label ID="lbTilte2" runat="server" Text="" Font-Size="Large"></asp:Label>
                </td>
            </tr>
            <tr>
                <td style="width: 430px">
                    <asp:Panel ID="Panel1" runat="server" Width="423px" Height="320px" >
                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="cungcapthuoc" Width="100%" BorderWidth="1px" BorderColor="Black" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" CellPadding="4" ForeColor="#333333" GridLines="None" AllowSorting="True" AllowPaging="True">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:BoundField DataField="Name" HeaderText="Tên" SortExpression="Name">
                                <HeaderStyle Height="20px" />
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Height="15px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Address" HeaderText="Địa Chỉ" SortExpression="Address">
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Tel" HeaderText="Số Điện Thoại" SortExpression="Tel">
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:BoundField>
                            <asp:TemplateField HeaderText="Xem">
                                <ItemTemplate>
                                    <asp:LinkButton ID="LinkButton1" runat="server" OnClick="nhacungcap_click"
                                            CommandArgument='<%# Eval("ID") %>'>xem</asp:LinkButton>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:TemplateField>
                        </Columns>
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <sortedascendingcellstyle backcolor="#F5F7FB" />
                        <sortedascendingheaderstyle backcolor="#6D95E1" />
                        <sorteddescendingcellstyle backcolor="#E9EBEF" />
                        <sorteddescendingheaderstyle backcolor="#4870BE" />
                    </asp:GridView>
                        <table style="width:100%;">
                            <tr>
                                <td>&nbsp;</td>
                                <td>
                                    <asp:Button ID="Button1" runat="server" style="margin-left: 165px" Text="New" OnClick="addnew_click"/>
                                </td>
                                <td>&nbsp;</td>
                            </tr>

                        </table>
                    <asp:SqlDataSource ID="cungcapthuoc" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:HOSPITALMANAGEMENTConnectionString %>" DeleteCommand="DELETE FROM [tbSupplier] WHERE [ID] = @original_ID AND [Name] = @original_Name AND [Address] = @original_Address AND [Tel] = @original_Tel" InsertCommand="INSERT INTO [tbSupplier] ([Name], [Address], [Tel]) VALUES (@Name, @Address, @Tel)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [ID], [Name], [Address], [Tel] FROM [tbSupplier] ORDER BY [Name]" UpdateCommand="UPDATE [tbSupplier] SET [Name] = @Name, [Address] = @Address, [Tel] = @Tel WHERE [ID] = @original_ID AND [Name] = @original_Name AND [Address] = @original_Address AND [Tel] = @original_Tel">
                        <DeleteParameters>
                            <asp:Parameter Name="original_ID" Type="Int32" />
                            <asp:Parameter Name="original_Name" Type="String" />
                            <asp:Parameter Name="original_Address" Type="String" />
                            <asp:Parameter Name="original_Tel" Type="String" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:Parameter Name="Name" Type="String" />
                            <asp:Parameter Name="Address" Type="String" />
                            <asp:Parameter Name="Tel" Type="String" />
                        </InsertParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="Name" Type="String" />
                            <asp:Parameter Name="Address" Type="String" />
                            <asp:Parameter Name="Tel" Type="String" />
                            <asp:Parameter Name="original_ID" Type="Int32" />
                            <asp:Parameter Name="original_Name" Type="String" />
                            <asp:Parameter Name="original_Address" Type="String" />
                            <asp:Parameter Name="original_Tel" Type="String" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                        </asp:Panel>
                </td>
                <td style="vertical-align:top">
                    <asp:Panel ID="pnInfo" runat="server" Height="103px" Width="500px" BorderColor="Black" BorderWidth="1px" BackColor="#FFFFCC" Visible="false">
                        <table style="width: 100%;">
                            <tr>
                                <td style="width: 102px;padding:7px">
                                    <asp:Label ID="lbNameNCC" runat="server" Text="Tên:"></asp:Label>
                                </td>
                                <td style="width:250px">
                                    <asp:TextBox ID="txtNameNCC" runat="server" BackColor="#FFFFCC" BorderStyle="None" Width="250px"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtNameNCC" ErrorMessage="Không để trống" ForeColor="#FF3300"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 102px;padding:7px; height: 13px;"><asp:Label ID="lbAddressNCC" runat="server" Text="Địa chỉ:"></asp:Label></td>
                                <td style="height: 13px; width: 250px;">
                                    <asp:TextBox ID="txtAddressNCC" runat="server" BackColor="#FFFFCC" BorderStyle="None" Width="250px"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtAddressNCC" ErrorMessage="Không để trống" ForeColor="#FF3300"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 102px;padding:7px;"><asp:Label ID="lbTelNCC" runat="server" Text="Số điện thoại:"></asp:Label></td>
                                <td style="width: 250px">
                                    <asp:TextBox ID="txtTelNCC" runat="server" BackColor="#FFFFCC" BorderStyle="None" Width="250px"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtTelNCC" ErrorMessage="Không để trống" ForeColor="#FF3300"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 102px;padding:7px;"></td>
                                <td style="width: 87px">
                                    <asp:Button ID="btOk" runat="server" Text="Edit" OnClick="edit_click"/></td>
                            </tr>
                        </table>

                    </asp:Panel>
                </td>
            </tr>
        </table>
    </asp:Content>

